furny.ga.util
Class ExtensionFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by furny.ga.util.ExtensionFileFilter

public class ExtensionFileFilter
extends javax.swing.filechooser.FileFilter

A filter for JFileChooser that filters files by extension.

Since:
11.08.2012
Author:
Stephan Dreyer

Field Summary
private  java.lang.String description
          A description for the file type.
private  java.lang.String extension
          The extension (for example, "png" for *.png files).
 
Constructor Summary
ExtensionFileFilter(java.lang.String description, java.lang.String extension)
          Standard constructor.
 
Method Summary
 boolean accept(java.io.File file)
          Returns true if the file ends with the specified extension.
 java.lang.String getDescription()
          Returns the description of the filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

description

private final java.lang.String description
A description for the file type.


extension

private final java.lang.String extension
The extension (for example, "png" for *.png files).

Constructor Detail

ExtensionFileFilter

public ExtensionFileFilter(java.lang.String description,
                           java.lang.String extension)
Standard constructor.

Parameters:
description - a description of the file type;
extension - the file extension;
Since:
11.08.2012
Method Detail

accept

public boolean accept(java.io.File file)
Returns true if the file ends with the specified extension.

Specified by:
accept in class javax.swing.filechooser.FileFilter
Parameters:
file - the file to test.
Returns:
A boolean that indicates whether or not the file is accepted by the filter.
Since:
11.08.2012

getDescription

public java.lang.String getDescription()
Returns the description of the filter.

Specified by:
getDescription in class javax.swing.filechooser.FileFilter
Returns:
A description of the filter.
Since:
11.08.2012